<template>
    <div class="xxlCheckboxRoot xxlNoselect" :style="{
        height: d + 'px', width: d + 'px'
    }" @click="change">
        <div class="xxlCtx" :class="checked ? 'scolor' : 'ncolor'" :style="{
            fontSize: d + 'px'
        }">
            {{ checked ? "&#xe600;" : "&#xe72f;" }}
        </div>
    </div>
</template>

<script>
export default {
    name: 'XxlCheckbox',

    data() {
        return {
            checked: false
        };
    },
    props: {
        d: {
            default: 20
        },
        sty:{},
        val: {
            type: Boolean,
            default: false
        },
        k:{
            default:"nokey"
        }
    },
    mounted() {
        this.checked = this.val
    },
    watch:{
        'val'(d){
            this.checked = d
        }
    },

    methods: {
        change() {
            this.checked = !this.checked
            this.$emit('change', this.checked,this.k);
        }
    },
};
</script>

<style lang="scss" scoped>
@import '../xxl-scss/xxl.scss';

@font-face {
    font-family: "checkbox";
    /* Project id 4007441 */
    src: url('./iconfont.ttf?t=1681137409065') format('truetype');
}

.xxlCtx {
    width: 100%;
    height: 100%;
    font-family: "checkbox" !important;
    font-style: normal;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
.scolor{
    color: $xxl-color-primary;
}
.ncolor{
    color: $xxl-color-noselect;
}
</style>